<template>
    <div>
        <van-nav-bar title="确认订单" left-text="返回" left-arrow @click-left="onClickLeft" />

        <van-contact-card v-if="!route.query.id" type="add" @click="onAdd" add-text="添加收货地址" />

        <van-cell v-else :title="route.query.name" icon="location-o" :label="route.query.address" :value="route.query.tel" />
    </div>
</template>

<script setup>
import { useRoute, useRouter } from 'vue-router';
// 获取地址栏参数
const route = useRoute()

// 跳转页面
const router = useRouter()

const onClickLeft = () => history.back();

const onAdd = () => {
    router.push({
        path: '/address'
    })
}

</script>